<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <Style>
        #div1{
            width: 100px;
            height: 100px;
            background-color: green;
            
        }
        .iiii{
            margin: 20px;
        }
    </Style>
</head>
<body>
    <div class="iiii">
    <div id='div1'>

    </div>
</div>
    <script>
        var odiv=document.getElementById('div1')
        console.log(odiv.offsetHeight)
        console.log(odiv.offsetLeft) //左边偏移量
        console.log(odiv.offsetTop)  //上边偏移
    </script>
</body>
</html>